#ifndef __VTL_LIST_H
#define __VTL_LIST_H

#include "vglobal.h"

#ifdef __cplusplus
extern "C" {
#endif

V_DECLEAR_HANDLE(vList);
V_DECLEAR_HANDLE(vListIterator);

typedef struct
{
    void *(*vListAlloc)(void *);
    void (*vListFree)(void *);
}vListOps;


//创建和销毁
vList *vListNew(size_t typesize,vListOps *ops);
void vListDelete(vList ls);


bool vListEmpty(vList ls);
size_t vListList(vList ls);

vListIterator vListPushFront(vList ls,void *data);
vListIterator vListPushBack(vList ls,void *data);
vListIterator vListInsert(vList ls,vListIterator pos,void *data);

void vListFreeIterator(vListIterator it);

void *vListPopFront(vList ls);
void *vListPopBack(vList ls);

vListIterator vListInsertBefore(vList ls,vListIterator pos,void *data);

vListIterator vListErase(vList ls,vListIterator it);

vListIterator vListEraseFront(vList ls);
vListIterator vListEraseBack(vList ls);

vListIterator vListFind(vList ls,void *data);
//翻转
void vListReverse(vList ls);

void vListClear(vList ls);
//合并
vList vListMerge(vList ls1,vList ls2);

#ifdef __cplusplus
}
#endif

#endif
